﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace Sample.Collection
{
    class ArrayAccessor
    {
        private object[] _array;

        public ArrayAccessor()
        {
            _array = new object[0];
        }

        public ArrayAccessor(params object[] array)
        {
            _array = array;
        }

        public void Print()
        {
            foreach (object aObject in _array)
            {
                Console.WriteLine(aObject.ToString());
            }
        }

        public object this[int index]
        {
            get { return _array[index]; }
            set { _array[index] = value; }
        }

        public ReadOnlyCollection<object> ReadOnlyArray
        {
            get { return Array.AsReadOnly<object>(_array); }
        }
    }
}
